package com.burpee.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.burpee.dao.ExerciseDao;
import com.burpee.ui.Exercise;
import com.burpee.ui.Food;

@Service(value="exerciseService")
public class ExerciseServiceImpl implements ExerciseService {
	
	@Autowired
	ExerciseDao exerciseDao;

	public List<Exercise> list(Exercise exercise) {
		return exerciseDao.list(exercise);
	}

	public boolean add(Exercise exercise) {
		if(exerciseDao.add(exercise) > 0){
			return true;
		}
		else{

			return false;
		}
	}

	public Exercise view(long exerciseNo) {
		return exerciseDao.view(exerciseNo);
	}

	public boolean modify(Exercise exercise) {
		if(exerciseDao.modify(exercise) > 0){
			return true;
		}
		else{

			return false;
		}
	}

	public boolean remove(long exerciseNo) {
		if(exerciseDao.remove(exerciseNo) > 0){
			return true;
		}
		else{

			return false;
		}
	}

	public List<Exercise> exercisePurposeSelectList(Exercise exercise) {
		
		return exerciseDao.exercisePurposeSelectList(exercise);
	}

	
	
////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////admin 운동 조회 테스트
	public List<Exercise> adminList() {
		
		return exerciseDao.adminList();
	}
	
	public List<Exercise> exerciseRegioList(){
		
		return exerciseDao.exerciseRegioList();
	}

	public int adminExerciseCount() {
		return exerciseDao.adminExerciseCount();
	}

	public List<Exercise> adminExerciseList(int currentPage) {
		return exerciseDao.adminExerciseList(currentPage);
	}

	public boolean adminExerciseRemove(String[] exerciseNo) {
		int result = 0;
		
		int checkboxtotal = exerciseNo.length;
		
		for(int i = 0; i < checkboxtotal; i++){
			result = exerciseDao.adminExerciseremove(exerciseNo[i]);
		}

		if(result > 0){
			return true;
		}
		else{
			return false;
		}
	}

	public boolean adminExerciseRemoveCancel(String[] exerciseNo) {
		int result = 0;
		
		int checkboxtotal = exerciseNo.length;
		
		for(int i = 0; i < checkboxtotal; i++){
			result = exerciseDao.adminExerciseremoveCancel(exerciseNo[i]);
		}

		if(result > 0){
			return true;
		}
		else{
			return false;
		}
	}
	
	
	
	

}
